<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui">

    <ui:composition>

        <p:dialog id="UsuariosCreateDlg" widgetVar="UsuariosCreateDialog" modal="true" resizable="false" appendToBody="true" header="#{bundle.CreateUsuariosTitle}">

            <h:form id="UsuariosCreateForm">

                <h:panelGroup id="display">
                    <p:panelGrid columns="2" rendered="#{usuariosController.selected != null}">

                        <h:outputLabel value="#{bundle.CreateUsuariosLabel_usuario}" for="usuario" />
                        <p:inputText id="usuario" value="#{usuariosController.selected.usuario}" title="#{bundle.CreateUsuariosTitle_usuario}" required="true" requiredMessage="#{bundle.CreateUsuariosRequiredMessage_usuario}"/>

                        <h:outputLabel value="#{bundle.CreateUsuariosLabel_contrasena}" for="contrasena" />
                        <p:inputText id="contrasena" value="#{usuariosController.selected.contrasena}" title="#{bundle.CreateUsuariosTitle_contrasena}" required="true" requiredMessage="#{bundle.CreateUsuariosRequiredMessage_contrasena}"/>

                        <h:outputLabel value="#{bundle.CreateUsuariosLabel_idPersonas}" for="idPersonas" />
                        <p:selectOneMenu id="idPersonas" value="#{usuariosController.selected.idPersonas}" required="true" requiredMessage="#{bundle.EditUsuariosRequiredMessage_idPersonas}">
                            <f:selectItem itemLabel="#{bundle.SelectOneMessage}"/>
                            <f:selectItems value="#{personasController.items}"
                                           var="idPersonasItem"
                                           itemValue="#{idPersonasItem}"
                                           itemLabel="#{idPersonasItem.idPersonas.toString()}"
                                           />
                            <f:converter binding="#{personasConverter}"/>
                        </p:selectOneMenu>
                    </p:panelGrid>
                    <p:commandButton actionListener="#{usuariosController.saveNew}" value="#{bundle.Save}" update="display,:UsuariosListForm:datalist,:growl" oncomplete="handleSubmit(xhr,status,args,UsuariosCreateDialog);"/>
                    <p:commandButton value="#{bundle.Cancel}" onclick="UsuariosCreateDialog.hide()"/>
                </h:panelGroup>

            </h:form>

        </p:dialog>

    </ui:composition>

</html>
